{% extends 'cms/cms_base.html' %}

{% block title %}
    熊熊论坛后台帖子管理
{% endblock %}

{% block head %}
    <script src="{{ url_for('static', filename='cms/js/posts.js') }}"></script>
{% endblock %}

{% block page_title %}
    熊熊帖子管理
{% endblock %}

{% block role %}
    {{ max_role }}
{% endblock %}

{% block content %}
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>标题</th>
            <th>发布时间</th>
            <th>板块</th>
            <th>作者</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for post in posts %}
            <tr data-id="{{ post.id }}" data-highlight="{{ 1 if post.highlight else 0 }}">
                <td><a target="_blank" href="{{ url_for('front.post_detail', post_id=post.id) }}">{{ post.title }}</a>
                </td>
                <td>{{ post.create_time }}</td>
                <td>{{ post.board.name }}</td>
                <td>{{ post.author.username }}</td>
                <td>
                    {% if post.highlight %}
                        <button class="btn btn-default btn-xs highlight-btn" style="width: 65px">取消加精</button>
                    {% else %}
                        <button class="btn btn-default btn-xs highlight-btn" style="width: 65px">加精</button>
                    {% endif %}

                    <button class="btn btn-danger btn-xs">移除</button>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    <div style="text-align:center;">
        {{ pagination.links }}
    </div>
{% endblock %}